package com.project.user.entity.entitly;

import com.untils.StaticMessage;

import java.util.Date;

public class LoginToken {
    private Integer id;

    private String loginUserid;

    private String loginIpv4;

    private String loginIpaddress;

    private String loginIssuccessfully;

    private Date loginCreatetime;

    private String loginSessionId;

    private Date loginEffectivetime;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getLoginUserid() {
        return loginUserid;
    }

    public void setLoginUserid(String loginUserid) {
        this.loginUserid = loginUserid == null ? null : loginUserid.trim();
    }

    public String getLoginIpv4() {
        return loginIpv4;
    }

    public void setLoginIpv4(String loginIpv4) {
        this.loginIpv4 = loginIpv4 == null ? null : loginIpv4.trim();
    }

    public String getLoginIpaddress() {
        return loginIpaddress;
    }

    public void setLoginIpaddress(String loginIpaddress) {
        this.loginIpaddress = loginIpaddress == null ? null : loginIpaddress.trim();
    }

    public String getLoginIssuccessfully() {
        return loginIssuccessfully;
    }

    public void setLoginIssuccessfully(String loginIssuccessfully) {
        this.loginIssuccessfully = loginIssuccessfully == null ? null : loginIssuccessfully.trim();
    }

    public Date getLoginCreatetime() {
        return loginCreatetime;
    }

    public void setLoginCreatetime(Date loginCreatetime) {
        this.loginCreatetime = loginCreatetime;
    }

    public String getLoginSessionId() {
        return loginSessionId;
    }

    public void setLoginSessionId(String loginSessionId) {
        this.loginSessionId = loginSessionId == null ? null : loginSessionId.trim();
    }

    public Date getLoginEffectivetime() {
        return loginEffectivetime;
    }

    public void setLoginEffectivetime(Date loginEffectivetime) {
        this.loginEffectivetime = loginEffectivetime;
    }

    public LoginToken(String loginUserid, String loginIpv4, String loginIpaddress, String loginIssuccessfully,String loginSessionId) {
        long now = System.currentTimeMillis();
        this.loginUserid = loginUserid;
        this.loginIpv4 = loginIpv4;
        this.loginIpaddress = loginIpaddress;
        this.loginIssuccessfully = loginIssuccessfully;
        this.loginCreatetime = new Date(now);
        this.loginSessionId = loginSessionId;
        this.loginEffectivetime= new Date(now + StaticMessage.Session_ID_TIMEOUT_DAY*24*60*60*1000);
    }

    public LoginToken() {
    }
}
